package com.yoyo.itravel.service;

import com.yoyo.itravel.bean.PageBean;
import com.yoyo.itravel.bean.User;
import com.yoyo.itravel.exceptions.UserException;

/**
 * @Description 用户操作服务层接口
 * 
 * @author HZX
 * @date 2020年4月14日 下午6:03:08
 */
public interface IUserService {
	/**
	 * @Description 用户注册
	 *
	 * @param user
	 * @return
	 * @throws UserException 
	 */
	boolean register(User user) throws UserException;

	/**
	 * @Description 用户登录（手机号或邮箱登录）
	 *
	 * @param phone_email
	 * @param password
	 * @return
	 */
	User login(String phone_email, String password) throws UserException;

	/**
	 * @Description 后台登录--管理员登录
	 *
	 * @param phone_email
	 * @param password
	 * @return cn.hut.travel.bean.User
	 */
	User adminLogin(String phone_email, String password) throws UserException;

	/**
	 * @Description 注销账号
	 *
	 * @param userId
	 * @return
	 */
	boolean deleteUser(String userId) throws UserException;

	/**
	 * @Description 通过用户id修改用户密码
	 *
	 * @param id
	 * @param newPassword
	 * @return
	 * @throws UserException
	 */
	boolean updatePasswordById(String id, String newPassword) throws UserException;
	
	/**
	 * @Description 通过用户id查询用户
	 *
	 * @param id
	 * @return
	 * @throws UserException
	 */
	User findById(String id) throws UserException;

    /**
     * @Description 通过用户手机号查询用户
     *
     * @param phone
     * @return
     * @throws UserException
     */
    boolean isPhoneAlreadyExist(String phone) throws UserException;

    /**
     * @Description 通过用户id查询用户
     *
     * @param email
     * @return
     * @throws UserException
     */
    boolean isEmailAlreadyExist(String email) throws UserException;

    /**
	 * @Description 通过用户id修改用户头像
	 *
	 * @param userId
	 * @param head_pic_src
	 * @return boolean
	 */
    boolean changeHeadPic(String userId, String head_pic_src) throws UserException;

	/**
	 * @Description 通过用户id修改用户个性签名
	 *
	 * @param userId
	 * @param signatureVal
	 * @return boolean
	 */
    boolean changeSignature(String userId, String signatureVal) throws UserException;

    /**
	 * @Description 通过修改用户id用户个人信息
	 *
	 * @param userId
	 * @param user
	 * @return boolean
	 */
	boolean updateUserInfo(String userId, User user) throws UserException;

	/**
	 * @Description 通过用户id修改用户邮箱
	 *
	 * @param userId
	 * @param email
	 * @return boolean
	 */
	boolean updateEmail(String userId, String email) throws UserException;

	/**
	 * @Description 通过用户id修改用户手机号
	 *
	 * @param userId
	 * @param phone
	 * @return boolean
	 */
	boolean updatePhone(String userId, String phone) throws UserException;

	/**
	 * @Description 找回密码
	 *
	 * @param phone_or_email
	 * @param new_pwd
	 * @return boolean
	 */
    boolean retrievePwd(String phone_or_email, String new_pwd) throws UserException;

    /**
	 * @Description 修改用户的在线状态
	 *
	 * @param onlineStatus
	 * @return boolean
	 */
    boolean updateOnlineStatus(String userId, Integer onlineStatus) throws UserException;

    /**
	 * @Description 分页查询所有用户
	 *
	 * @param currentPage
	 * @param pageSize
	 * @return cn.hut.travel.bean.PageBean<cn.hut.travel.bean.Sight>
	 */
	PageBean<User> findAllByPage(int currentPage, int pageSize) throws UserException;


}
